# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.StorageTransfer.V1.Model.NotificationConfig do
  @moduledoc """
  Specification to configure notifications published to Pub/Sub. Notifications are published to the customer-provided topic using the following `PubsubMessage.attributes`: * `"eventType"`: one of the EventType values * `"payloadFormat"`: one of the PayloadFormat values * `"projectId"`: the project_id of the `TransferOperation` * `"transferJobName"`: the transfer_job_name of the `TransferOperation` * `"transferOperationName"`: the name of the `TransferOperation` The `PubsubMessage.data` contains a TransferOperation resource formatted according to the specified `PayloadFormat`.

  ## Attributes

  *   `eventTypes` (*type:* `list(String.t)`, *default:* `nil`) - Event types for which a notification is desired. If empty, send notifications for all event types.
  *   `payloadFormat` (*type:* `String.t`, *default:* `nil`) - Required. The desired format of the notification message payloads.
  *   `pubsubTopic` (*type:* `String.t`, *default:* `nil`) - Required. The `Topic.name` of the Pub/Sub topic to which to publish notifications. Must be of the format: `projects/{project}/topics/{topic}`. Not matching this format results in an INVALID_ARGUMENT error.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :eventTypes => list(String.t()) | nil,
          :payloadFormat => String.t() | nil,
          :pubsubTopic => String.t() | nil
        }

  field(:eventTypes, type: :list)
  field(:payloadFormat)
  field(:pubsubTopic)
end

defimpl Poison.Decoder, for: GoogleApi.StorageTransfer.V1.Model.NotificationConfig do
  def decode(value, options) do
    GoogleApi.StorageTransfer.V1.Model.NotificationConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.StorageTransfer.V1.Model.NotificationConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
